package model;

import java.sql.Timestamp;

/**
 * This is a builder class for Email.
 * @author buthainahaldosary
 * @since May 13, 2013
 */

public class EmailBuilder 
{
	 
	 String to;
	 String from;
	 String subject;
	 String body;
	 boolean read;
	 Timestamp timestamp;
	 int folderId;
	 
	/**
	 * 
	 * @param _to: String representing to email address.
	 * @return EmailBuilder object.
	 */
	 
	 public EmailBuilder withTo(String _to)
	 {
		 this.to=_to;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _from: String representing from email address.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withFrom(String _from)
	 {
		 this.from=_from;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _subject: String representing the subject of the email.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withSubject(String _subject)
	 {
		 this.subject=_subject;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _body: String representing the body of the email.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withBody(String _body)
	 {
		 this.body=_body;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _read: Boolean indicating if the email has been read or not.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withRead(Boolean _read)
	 {
		 this.read=_read;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _timestamp: time and date of email.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withTimestamp(Timestamp _timestamp)
	 {
		 this.timestamp=_timestamp;
		 return this;
	 }
	 
	 /**
	  * 
	  * @param _folderId: Id representing the current folder the email resides in.
	  * @return EmailBuilder object.
	  */
	 public EmailBuilder withFolderId(int _folderId)
	 {
		 this.folderId=_folderId;
		 return this;
	 }
	 
	 /**
	  * 
	  * @return concrete newly built email object.
	  */
	 public Email build()
	 {
		 return new Email(to,from,subject,body,read,timestamp,folderId);
	 }

	 /**
	  * 
	  * @return String: to
	  */
	public String getTo() {
		return to;
	}


	public String getFrom() {
		return from;
	}

	public String getSubject() {
		return subject;
	}


	public String getBody() {
		return body;
	}


	public boolean isRead() {
		return read;
	}


	public Timestamp getTimestamp() {
		return timestamp;
	}



	public int getFolderId() {
		return folderId;
	}


}
